﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Domain.Common;
using Domain.Map;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace UIComponentSprite.SmallMap
{
    public class MapbuildingSprite:UserControlledSprite
    {
        public Point MapDisplayOffset;
        public Point basePosition=new Point();
      
        public MapbuildingSprite(Point p)
        {
            basePosition.X = p.X;
            basePosition.Y = p.Y;
            DrawPosition.Width =3;
            DrawPosition.Height =3;
        }
        public override void Draw(GameTime gameTime)
        {
            if (!Showing)
                return;
            SpriteBatch.Draw(CommonImage, DrawPosition, Color.White);
        }

        public override void Update(GameTime gameTime)
        {
            if (!Showing)
                return;
            LoadPic();
            //Rectangle rectDes = new Rectangle(0, 0, GameScreen.ViewportSize.X, GameScreen.ViewportSize.Y);
            //Rectangle rect = new Rectangle(0, 0, Map.MapDimensions.X, Map.MapDimensions.Y);
            //var re= new Microsoft.Xna.Framework.Rectangle(rectDes.Right - rect.Width, rectDes.Bottom - rect.Height, rect.Width, rect.Height);
            // this.MapDisplayOffset =new Point(re.X,re.Y);
             DrawPosition.X = basePosition.X + GameScreen.ViewportSize.X - Map.MapDimensions.X-1;
             DrawPosition.Y = basePosition.Y + GameScreen.ViewportSize.Y - Map.MapDimensions.Y-1;
        }
       

        protected override void LoadPic()
        {
            if (CommonImage == null)
                CommonImage = Game.Content.Load<Texture2D>(@"Images\smallMap\building");
           
        }
    }
}
